//
//  MainViewController.swift
//  VVo
//
//  Created by Mr.Run on 2017/9/19.
//  Copyright © 2017年 Mr.Run. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        addChildViewController(HomeViewController(), title: "首页", imageName: "tabbar_home")
        addChildViewController(MessageViewController(), title: "消息", imageName: "tabbar_message_center")
        addChildViewController(DiscoverViewController(), title: "发现", imageName: "tabbar_discover")
        addChildViewController(ProfileViewController(), title: "我", imageName: "tabbar_profile")
        
    }
    
    fileprivate func addChildViewController(_ childVC: UIViewController, title: String, imageName: String) {
        
        childVC.title = title
        childVC.view.backgroundColor = UIColor.yellow
        childVC.tabBarItem.image = UIImage(named: imageName)
        
        childVC.tabBarItem.selectedImage = UIImage(named: imageName + "_highlighted")
        let childNav = UINavigationController(rootViewController: childVC)
        
        addChildViewController(childNav)
    }
    
}
